import { queryProvinceUser } from '@/api/info'

const judgeIsProvinceUser = {
  state: {
    // 产品树形列表
    isProvinceUser: false
  },
  getters: {
    isProvinceUser: (state) => state.isProvinceUser
  },
  mutations: {
    SET_IS_PROVINCE_USER: (state, isProvinceUser) => {
      state.isProvinceUser = isProvinceUser
    }
  },
  actions: {
    /** 获取产品树形列表 */
    getIsProvinceUser({ commit }) {
      const params = {
      }
      return new Promise((resolve, reject) => {
        queryProvinceUser(params)
          .then((res) => {
            if (res.success) {
              commit('SET_IS_PROVINCE_USER', res.result)
              resolve(res.result)
            } else {
              reject(res.message)
            }
          })
          .catch((err) => {
            reject(err)
          })
      })
    }
  }
}
export default judgeIsProvinceUser
